import http from '@/http/api.js'

// 商品列表
export const getGoodList = (params) => {
	return http.request({
		url: '/api/commodity/page',
		method: 'GET',
		params
	})
}
export const getGoodDetail = (params) => {
	return http.request({
		url: '/api/commodity/detail',
		method: 'GET',
		params
	})
}
export const generateUuid = (params) => {
	return http.request({
		url: '/api/WxPay/generateUuid',
		method: 'GET',
		params
	})
}
export const createOrder = (data) => {
	return http.request({
		url: '/api/WxPay/createOrder',
		method: 'POST',
		data:data
	})
}
export const getOpenId = (data) => {
	return http.request({
		url: '/api/getOpenId',
		method: 'POST',
		data:data
	})
}
export const getOrderList = (params) => {
	return http.request({
		url: '/api/order/getMyOrder',
		method: 'GET',
		params
	})
}
export const cancelOrder = (data) => {
	return http.request({
		url: '/api/order/cancel',
		method: 'POST',
		data:data
	})
}
export const getOrderDetail = (params) => {
	return http.request({
		url: '/api/order/detail',
		method: 'GET',
		params
	})
}

export const verifyOrder = (data) => {
	return http.request({
		url: '/api/order/verify',
		method: 'POST',
		data:data
	})
}


export const buyOrder = (data) => {
	return http.request({
		url: '/api/order/update',
		method: 'POST',
		data:data
	})
}


export default {
	getGoodList,
	generateUuid,
	createOrder,
	getGoodDetail,
	getOpenId,
	getOrderList,
	cancelOrder,
	getOrderDetail,
	verifyOrder,
	buyOrder
}
